package org.example.constant;

import javafx.scene.Scene;

public class AdbConstant {
    public static final String DEVICES = " adb devices";
    public static final String ADB = " adb ";
    public static final String SHELL = " shell ";
    public static final String PULL = " pull ";
    public static final String KILL = " kill ";
    public static final String LOGCAT = " logcat ";
    public static final String JIT_PREFIX = "cmd package compile -r bg-dexopt -f ";
    public static final String JIT_PREFIX_SPEED = "cmd package compile -m speed -f ";
    public static final String CURRENT_PACKAGE = "dumpsys window | findstr mCurrentFocus";
    private static final String PM_LIST_PACKAGE = "pm list package -f | findstr ";
    public static final String CPU_CORE_COUNT = "cat /sys/devices/system/cpu/possible";
    public static final String MEM_INFO = "cat /proc/meminfo";
    public static final String START_YLOG = "am start com.sprd.logmanager/com.sprd.logmanager.logui.LogMainActivity";
    public static final String YLOG_PATH = "data/ylog ";
    public static final String SCREEN_CAP = "screencap ";
    public static final String SCREEN_CAP_PATH = "/sdcard/screenshot.png ";
    public static final String SCREEN_RECORD = "screenrecord ";
    public static final String SCREEN_RECORD_PATH = "/sdcard/screenrecord.mp4 ";
    //获取当前录屏的进程
    public static final String PS_SCREEN_RECORD = "ps | findstr screenrecord ";
    public static final String TRACE_PERFETTO_PATH = "/data/misc/perfetto-traces/trace_log ";
    public static final String INPUT_BACK = "input keyevent 4";
    public static final String INPUT_HOME = "input keyevent 3";
    public static final String LOGCAT_FIND_STR_DISPLAYED = " | findstr Displayed";

    public static String getDumpPackage(String pkgName) {
        return "dumpsys package " + pkgName;
    }
    public static String getForceStop(String pkgName) {
        return "am force-stop " + pkgName;
    }
    public static String getAppStart(String mainActivity) {
        return "am start -W " + mainActivity;
    }
    //public static String getTracePerfetto(int time, String[] tags) {
    public static String getTracePerfetto(int time, String tags) {
        int buffer = 5 * time;
        int save = 5 * time;
//        return "perfetto -o /data/misc/perfetto-traces/trace_log -t "+time+"s -b "+buffer+"mb -s "+save+"mb sched freq idle am wm view input res ss gfx rs hal pm disk binder_driver binder_lock dalvik ";
        return "perfetto -o /data/misc/perfetto-traces/trace_log -t "+time+"s -b "+buffer+"mb -s "+save+"mb " + tags;
    }

    public static String getAdbCpuMaxFreq(int i) {
        return "cat /sys/devices/system/cpu/cpu"+i+"/cpufreq/cpuinfo_max_freq";
    }

    public static String getPmListPackage(String pkg) {
        return PM_LIST_PACKAGE + pkg;
    }
    public static String getPullYlogCmd(String target) { return YLOG_PATH + target;}
}
